package com.quasar.hpatient.module.discover_community;

import android.graphics.Color;
import android.support.v4.app.FragmentActivity;
import android.support.v7.widget.RecyclerView;
import android.widget.ImageView;

import com.quasar.hpatient.R;
import com.quasar.hpatient.bean.discover_community.CommunityMulitModel;

import java.util.List;

import lib.quasar.base.frame.BaseFragment;
import lib.quasar.widget.photo.PhotoLayout;

/**
 * description: 发现 ==> 社区
 * created by kalu on 2018/3/19 16:14
 */
public class DiscoverCommunityFragment extends BaseFragment<DiscoverCommunityPresenter> implements DiscoverCommunityView {

    @Override
    public int initView() {
        return R.layout.fragment_discover_community;
    }

    @Override
    public void initDataLocal() {

        final RecyclerView recycler = getView().findViewById(R.id.discover_community_list);
        getPresenter().initList(this, recycler);
    }

    @Override
    public void initDataNet() {
    }

    @Override
    public void showPhoto(int defaultPosition, List<CommunityMulitModel.CommunityImageModel> imageLittleUrlList, List<CommunityMulitModel.CommunityImageModel> imageUrlList, List<ImageView> imageViews) {

        FragmentActivity activity = getActivity();
        if (null == activity || imageLittleUrlList.isEmpty() || imageUrlList.isEmpty() || imageViews.isEmpty())
            return;

        new PhotoLayout.Builder(activity)
                .setPhotoLongPressSave(false)
                .setPhotoOpenTransAnim(true)
                .setPhotoDefaultPosition(defaultPosition)
                .setPhotoBackgroundColor(Color.BLACK)
                .setPhotoDefaultResource(R.mipmap.ic_launcher)
                .setPhotoViewList(imageViews)
                .setPhotoUrlList(imageUrlList)
                .setPhotoLittleUrlList(imageLittleUrlList)
                .show();
    }
}